package main

import "fmt"

func main() {
	//死锁3：多go程，多channel交叉死锁
	//a go程掌握M的同时，尝试拿N；B go程掌握N的同时尝试拿M
	ch1 := make(chan int)
	ch2 := make(chan int)

	go func() {
		for {
			select {
			case num := <-ch1:
				fmt.Println(num)
				ch2 <- 12
			}
		}
	}()

	for {
		select {
		case num := <-ch2:
			fmt.Println(num)
			ch1 <- 34
		}
	}
}
